from django.urls import re_path
from . import consumers

# websocket_urlpatterns = [
#     re_path(r'ws/chat/(?P<room_name>\w+)/$', consumers.ChatConsumer.as_asgi()),
# ]


websocket_urlpatterns = [
    # 配置 WebSocket 路由（支持带斜线和不带斜线两种形式）
    re_path(r'^ws/chat/?$', consumers.ChatConsumer.as_asgi()),

    # 如果需要多个聊天室可以扩展其他路由
    # re_path(r'^ws/chat/(?P<room_name>\w+)/$', consumers.ChatConsumer.as_asgi()),
]
